

********* This program generates the results in Table A8, Panel B, of the paper: specification with quantiles of the shock (treatment) ************

clear all
set more off, permanently
cd "$localdir\Data"
global output "$localdir\Output"







***************************************************** ASSESSMENT OF NATIONAL UNEMPLOYMENT RATE ******************************************************

* Outcome only available in 2011 and 2012

use "National Unemployment RF for Analysis - Last Year.dta", clear

bysort unique year: egen grossunemp_enter_network_share=mean(grossunemp_enter_network)
drop *_network
duplicates drop unique year, force

tab year 

g share_q4=.
sort year
levelsof year, local(levels)
foreach y of local levels {
xtile temp=grossunemp_enter_network_share if year==`y', nq(4)
replace share_q4=temp if year==`y'
drop temp
}

lab def quant 1 "Network shock share q1" 2 "Network shock share q2" 3 "Network shock share q3" 4 "Network shock share q4"
lab val share_q4 quant

replace unemp_rate_estimate=unemp_rate_estimate/100

* Results
display c(current_time)
reghdfe unemp_rate_estimate ib1.share_q4, absorb(both ind2_year ocp_year educ_year) cluster(muni)
sum unemp_rate_estimate if e(sample)==1
local mean_outcome=r(mean)
local sd_outcome=r(sd)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==1
local mean_shock1=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==2
local mean_shock2=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==3
local mean_shock3=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==4
local mean_shock4=r(mean)
outreg2 using "$output\TableA8_PanelB.xls", replace nocons nor ctitle("Guess national unemployment rate") bdec(3) sdec(3) adec(3) label  ///
adds(Outcome mean,`mean_outcome', Outcome sd,`sd_outcome', Unemployment shock q1 mean,`mean_shock1', Unemployment shock q2 mean,`mean_shock2', Unemployment shock q3 mean,`mean_shock3', Unemployment shock q4 mean,`mean_shock4')

display c(current_time)









***************************************************** FORECAST OF NATIONAL UNEMPLOYMENT RATE ******************************************************

* Outcome only available in 2011

use "National Unemployment Forecast RF for Analysis - Last Year.dta", clear

bysort unique year: egen grossunemp_enter_network_share=mean(grossunemp_enter_network)
drop *_network
duplicates drop unique year, force

tab year 

g share_q4=.
sort year
levelsof year, local(levels)
foreach y of local levels {
xtile temp=grossunemp_enter_network_share if year==`y', nq(4)
replace share_q4=temp if year==`y'
drop temp
}

lab def quant 1 "Network shock share q1" 2 "Network shock share q2" 3 "Network shock share q3" 4 "Network shock share q4"
lab val share_q4 quant

replace unemp_rate_estimate_next=unemp_rate_estimate_next/100

* Results
display c(current_time)
reghdfe unemp_rate_estimate_next ib1.share_q4, absorb(both ind2_year ocp_year educ_year) cluster(muni)
sum unemp_rate_estimate_next if e(sample)==1
local mean_outcome=r(mean)
local sd_outcome=r(sd)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==1
local mean_shock1=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==2
local mean_shock2=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==3
local mean_shock3=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==4
local mean_shock4=r(mean)
outreg2 using "$output\TableA8_PanelB.xls", append nocons nor ctitle("National unemployment rate expectation") bdec(3) sdec(3) adec(3) label  ///
adds(Outcome mean,`mean_outcome', Outcome sd,`sd_outcome', Unemployment shock q1 mean,`mean_shock1', Unemployment shock q2 mean,`mean_shock2', Unemployment shock q3 mean,`mean_shock3', Unemployment shock q4 mean,`mean_shock4')

display c(current_time)







***************************************************** UNEMPLOYMENT OUTCOMES - PROBABILITY ******************************************************

use "Unemployment Outcomes RF for Analysis - Last Year.dta", clear

bysort unique year: egen grossunemp_enter_network_share=mean(grossunemp_enter_network)
drop *_network
duplicates drop unique year, force

tab year 

g share_q4=.
sort year
levelsof year, local(levels)
foreach y of local levels {
xtile temp=grossunemp_enter_network_share if year==`y', nq(4)
replace share_q4=temp if year==`y'
drop temp
}

lab def quant 1 "Network shock share q1" 2 "Network shock share q2" 3 "Network shock share q3" 4 "Network shock share q4"
lab val share_q4 quant

replace prob_unemployed=prob_unemployed/100

* Results
display c(current_time)
reghdfe prob_unemployed ib1.share_q4, absorb(both ind2_year ocp_year educ_year) cluster(muni)
sum prob_unemployed if e(sample)==1
local mean_outcome=r(mean)
local sd_outcome=r(sd)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==1
local mean_shock1=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==2
local mean_shock2=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==3
local mean_shock3=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==4
local mean_shock4=r(mean)
outreg2 using "$output\TableA8_PanelB.xls", append nocons nor ctitle("Own unemployment expectation") bdec(3) sdec(3) adec(3) label  ///
adds(Outcome mean,`mean_outcome', Outcome sd,`sd_outcome', Unemployment shock q1 mean,`mean_shock1', Unemployment shock q2 mean,`mean_shock2', Unemployment shock q3 mean,`mean_shock3', Unemployment shock q4 mean,`mean_shock4')

display c(current_time)









***************************************************** UNEMPLOYMENT OUTCOMES - UI POLICY ******************************************************

use "UI Outcomes RF for Analysis - Last Year.dta", clear

bysort unique year: egen grossunemp_enter_network_share=mean(grossunemp_enter_network)
drop *_network
duplicates drop unique year, force

tab year 

g share_q4=.
sort year
levelsof year, local(levels)
foreach y of local levels {
xtile temp=grossunemp_enter_network_share if year==`y', nq(4)
replace share_q4=temp if year==`y'
drop temp
}

lab def quant 1 "Network shock share q1" 2 "Network shock share q2" 3 "Network shock share q3" 4 "Network shock share q4"
lab val share_q4 quant

* Results
display c(current_time)
reghdfe more_ui ib1.share_q4, absorb(both ind2_year ocp_year educ_year) cluster(muni)
sum more_ui if e(sample)==1
local mean_outcome=r(mean)
local sd_outcome=r(sd)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==1
local mean_shock1=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==2
local mean_shock2=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==3
local mean_shock3=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==4
local mean_shock4=r(mean)
outreg2 using "$output\TableA8_PanelB.xls", append nocons nor ctitle("Want more unemployment insurance") bdec(3) sdec(3) adec(3) label  ///
adds(Outcome mean,`mean_outcome', Outcome sd,`sd_outcome', Unemployment shock q1 mean,`mean_shock1', Unemployment shock q2 mean,`mean_shock2', Unemployment shock q3 mean,`mean_shock3', Unemployment shock q4 mean,`mean_shock4')

display c(current_time)








***************************************************** IDEOLOGY OUTCOMES ******************************************************

use "Ideology RF for Analysis - Last Year.dta", clear

bysort unique year: egen grossunemp_enter_network_share=mean(grossunemp_enter_network)
drop *_network
duplicates drop unique year, force

tab year 

g share_q4=.
sort year
levelsof year, local(levels)
foreach y of local levels {
xtile temp=grossunemp_enter_network_share if year==`y', nq(4)
replace share_q4=temp if year==`y'
drop temp
}

lab def quant 1 "Network shock share q1" 2 "Network shock share q2" 3 "Network shock share q3" 4 "Network shock share q4"
lab val share_q4 quant

* Results
display c(current_time)
reghdfe govt_more_help ib1.share_q4, absorb(both ind2_year ocp_year educ_year) cluster(muni)
sum govt_more_help if e(sample)==1
local mean_outcome=r(mean)
local sd_outcome=r(sd)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==1
local mean_shock1=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==2
local mean_shock2=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==3
local mean_shock3=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==4
local mean_shock4=r(mean)
outreg2 using "$output\TableA8_PanelB.xls", append nocons nor ctitle("Government should support the poor") bdec(3) sdec(3) adec(3) label  ///
adds(Outcome mean,`mean_outcome', Outcome sd,`sd_outcome', Unemployment shock q1 mean,`mean_shock1', Unemployment shock q2 mean,`mean_shock2', Unemployment shock q3 mean,`mean_shock3', Unemployment shock q4 mean,`mean_shock4')

display c(current_time)











***************************************************** ECONOMIC POLICY ******************************************************

* These questions were not asked in 2012

use "Economic Policy Outcomes RF for Analysis - Last Year.dta", clear

bysort unique year: egen grossunemp_enter_network_share=mean(grossunemp_enter_network)
drop *_network
duplicates drop unique year, force

tab year 

g share_q4=.
sort year
levelsof year, local(levels)
foreach y of local levels {
xtile temp=grossunemp_enter_network_share if year==`y', nq(4)
replace share_q4=temp if year==`y'
drop temp
}

lab def quant 1 "Network shock share q1" 2 "Network shock share q2" 3 "Network shock share q3" 4 "Network shock share q4"
lab val share_q4 quant

* Results
display c(current_time)
reghdfe gov_solution ib1.share_q4, absorb(both ind2_year ocp_year educ_year) cluster(muni)
sum gov_solution if e(sample)==1
local mean_outcome=r(mean)
local sd_outcome=r(sd)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==1
local mean_shock1=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==2
local mean_shock2=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==3
local mean_shock3=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==4
local mean_shock4=r(mean)
outreg2 using "$output\TableA8_PanelB.xls", append nocons nor ctitle("Support non-market-based stimulus") bdec(3) sdec(3) adec(3) label  ///
adds(Outcome mean,`mean_outcome', Outcome sd,`sd_outcome', Unemployment shock q1 mean,`mean_shock1', Unemployment shock q2 mean,`mean_shock2', Unemployment shock q3 mean,`mean_shock3', Unemployment shock q4 mean,`mean_shock4')

display c(current_time)








***************************************************** VOTING LEFT (INTENTION) ******************************************************

use "Voting RF for Analysis - Last Year.dta", clear

bysort unique year: egen grossunemp_enter_network_share=mean(grossunemp_enter_network)
drop *_network
duplicates drop unique year, force

tab year 

g share_q4=.
sort year
levelsof year, local(levels)
foreach y of local levels {
xtile temp=grossunemp_enter_network_share if year==`y', nq(4)
replace share_q4=temp if year==`y'
drop temp
}

lab def quant 1 "Network shock share q1" 2 "Network shock share q2" 3 "Network shock share q3" 4 "Network shock share q4"
lab val share_q4 quant

* Results
display c(current_time)
reghdfe vote_left ib1.share_q4, absorb(both ind2_year ocp_year educ_year) cluster(muni)
sum vote_left if e(sample)==1
local mean_outcome=r(mean)
local sd_outcome=r(sd)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==1
local mean_shock1=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==2
local mean_shock2=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==3
local mean_shock3=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==4
local mean_shock4=r(mean)
outreg2 using "$output\TableA8_PanelB.xls", append nocons nor ctitle("Intend to vote for left party") bdec(3) sdec(3) adec(3) label  ///
adds(Outcome mean,`mean_outcome', Outcome sd,`sd_outcome', Unemployment shock q1 mean,`mean_shock1', Unemployment shock q2 mean,`mean_shock2', Unemployment shock q3 mean,`mean_shock3', Unemployment shock q4 mean,`mean_shock4')

display c(current_time)











***************************************************** VOTED LEFT ******************************************************

* These questions were only asked in 2011 - ie the year before which the shocks definitely occurred before the election

use "Voted RF for Analysis - Last Year.dta", clear

bysort unique year: egen grossunemp_enter_network_share=mean(grossunemp_enter_network)
drop *_network
duplicates drop unique year, force

tab year 

g share_q4=.
sort year
levelsof year, local(levels)
foreach y of local levels {
xtile temp=grossunemp_enter_network_share if year==`y', nq(4)
replace share_q4=temp if year==`y'
drop temp
}

lab def quant 1 "Network shock share q1" 2 "Network shock share q2" 3 "Network shock share q3" 4 "Network shock share q4"
lab val share_q4 quant

* Results
display c(current_time)
reghdfe voted_left_2011 ib1.share_q4, absorb(both ind2_year ocp_year educ_year) cluster(muni)
sum voted_left_2011 if e(sample)==1
local mean_outcome=r(mean)
local sd_outcome=r(sd)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==1
local mean_shock1=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==2
local mean_shock2=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==3
local mean_shock3=r(mean)
sum grossunemp_enter_network_share if e(sample)==1 & share_q4==4
local mean_shock4=r(mean)
outreg2 using "$output\TableA8_PanelB.xls", append nocons nor ctitle("Voted for left party in 2001") bdec(3) sdec(3) adec(3) label  ///
adds(Outcome mean,`mean_outcome', Outcome sd,`sd_outcome', Unemployment shock q1 mean,`mean_shock1', Unemployment shock q2 mean,`mean_shock2', Unemployment shock q3 mean,`mean_shock3', Unemployment shock q4 mean,`mean_shock4')

display c(current_time)









































